package nccloud.web.gl.ref;

import java.util.Map;

import nccloud.framework.web.processor.IRefSqlBuilder;
import nccloud.framework.web.processor.refgrid.RefQueryInfo;
import nccloud.framework.web.ui.meta.RefMeta;
import nccloud.pubitf.platform.db.SqlParameterCollection;

public class OrderbyRefSqlBuilder implements IRefSqlBuilder{
	@Override
	public String getExtraSql(RefQueryInfo refQueryInfo, RefMeta refMeta) {
		StringBuilder sql = new StringBuilder();
		if(refQueryInfo != null && refQueryInfo.getQueryCondition() != null) {
			Map<String, String> condition = refQueryInfo.getQueryCondition();
			String USERGROUPCODE = condition.get("USERGROUPCODE");
			sql.append("PK_USERGROUPFORCREATE in (");
			sql.append("select pk_usergroup from sm_usergroup where groupcode = '"+USERGROUPCODE+"'");
			sql.append(")");
		}
		return sql.toString();
	}
	
	@Override
	public SqlParameterCollection getExtraSqlParameter(RefQueryInfo refQueryInfo, RefMeta refMeta) {
		return null;
	}
	
	@Override
	public String getOrderSql(RefQueryInfo refQueryInfo, RefMeta refMeta) {
		return "";
	}
}
